import lejos.nxt.*;
import lejos.robotics.navigation.*;
import lejos.robotics.proposal.DifferentialPilot;

public class Main  {
	

	public static void main(String args[]) {
		Main main = new Main();
		main.run();
	}

	public void run() {		
		DifferentialPilot pilot = new DifferentialPilot(55.0f, 111.0f, Motor.B, Motor.C, false);
		pilot.reset();

		InterfaceController interfaceController = new InterfaceController();
		int sides = interfaceController.promptForInteger("Number of sides:", 2, 1);
		int sideLength = interfaceController.promptForInteger("Length of side:", 100, 50, 0);
		float anglePerTurn = 360.0f / (float)sides;
		
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
		}
		
		LCD.clearDisplay();
		LCD.drawString("Running...", 0, 0);
		
		for (int i = 0; i < sides; i++) {
			pilot.travel(sideLength);
			pilot.rotate(anglePerTurn);
		}
	}
	
	

	

	

}
